function GM:PlayerInitialSpawn( ply )
	
	C.SyncMap( ply );
	
	C.InitCredits( ply );
	C.RefreshCredits( ply );
	
	ply.NextOxyDamage = 0;
	ply.NextTempDamage = 0;
	
	local del = 0;
	
	for _, v in pairs( ents.GetAll() ) do
		
		if( v.Cosmic ) then
			
			for _, n in pairs( v.Links or { } ) do
				
				timer.Simple( del, function() -- ewwwwwww
					
					umsg.Start( "LE" );
						umsg.Entity( v );
						umsg.Entity( n );
					umsg.End();
					
				end );
				
				del = del + 0.01;
				
			end
			
		end
		
	end
	
	self.BaseClass:PlayerInitialSpawn( ply );
	
end

function GM:PlayerSpawn( ply )
	
	local p = C.InPlanet( ply );
	C.MapObjects.Planets[p].spawn = true; -- Identify which planets are spawn planets.
	
	ply.NextPlanetCheck = 0;
	
	self.BaseClass:PlayerSpawn( ply );
	
end

function GM:PlayerDeath( ply, inf, killer )
	
	self.BaseClass:PlayerDeath( ply, inf, killer );
	
	timer.Simple( 0.1, function() -- There has to be a better way, timers suck
		
		if( ply and ply:IsValid() ) then
			
			if( C.GetGravity( ply ) == 0 ) then
				
				umsg.Start( "ZGR" );
					umsg.Entity( ply );
				umsg.End();
				
			end
			
		end
		
	end );
	
end

function C.CheckNoClip( ply )
	
	if( ply:IsAdmin() ) then return end
	
	if( ply:GetMoveType() == 8 ) then
		
		if( C.InPlanet( ply ) == 0 ) then
			
			ply:SetMoveType( 2 );
			
		end
		
	end
	
end

function GM:EntityRemoved( e )
	
	if( e.Cosmic and e.CosmicPrice ) then
		
		C.RefundEnt( e );
		
	end
	
end

function GM:ShowHelp( ply )
	
	umsg.Start( "SH", ply );
	umsg.End();
	
end